<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 CalenderUI();
 link_js(array('jquery.fixedheader','bootstrap-typeahead'),'asset/js/');
 //link_js('akun_jurnal','application/zetro_js/');
 ?>
<!--<div class='container'>-->
     <div class="tabbable"> <!-- Only required for left/right tabs -->
	<?=$tab_header;?>
       <div class="tab-content" style='height:450px;'>
        <div class="btn-group">
        <a class="btn btn-small dropdown-toggle" data-toggle="dropdown" href="#">Filter by
        <span class="caret"></span>
        </a>
        <ul class="dropdown-menu">
            <li><a href='#' onclick="_aksi('1');"><i class='cus-star'></i> Akun Aktiva </a></li>
            <li><a href='#' onclick="_aksi('0');"><i class='cus-star'></i> Akun Pasiva</a></li>
            <li><a href='#' onclick="_aksi('01');"><i class='cus-star'></i> All</a></li>
        </ul>
        </div> <!--<hr />-->
		<form class="navbar-form pull-right">
		<input type="text" id='cari' class="span3" placeholder="find by deskripsi akun">
		<button type="button" class="btn btn-small" onClick='_cari();'><i class='cus-find'></i></button>
		</form>
		 <hr />
            <div class="tab-pane active" id="table2"><?=$this->zetro_auth->allAuth($list,'kontra_akun');?></div>
       </div>
    </div>
	<div id='tree'></div>
<?=$modal;?>
<!--</div>-->
<input type='hidden' id='row_aktif' value=''/>

<script language='javascript'>
$(document).ready(function(e) {
	_show_data('');
	_get_akun();
	var w=$('#id_kontra_akun').width();
	$('#b_Simpan').click(function(){ _simpan_data();$('#myModal').modal('hide');});
	$('#d_Simpan').click(function(){$('#myModal').modal('hide');});
});

function _show_data(fp,ca)
{
	$.post('get_list_aktiva_akun',{
		'orderby':fp,
		'cari':ca},
	function(result){
		$('#NewList tbody').html(result);
		(fp=='')?fixHeader('NewList',70,335):'';
	})
}
function _get_akun()
{
	$.post('get_akun_tphead',{'igrup':'0'},
	function(result){
		$('#id_kontra_akun').typeahead({source:$.parseJSON(result),items:50});
	})
}
function btn_click(id,aksi)
{
	switch(aksi)
	{
		case "Add_kontra":
			$('#myModalLabel').html("<i class='cus-building-edit'></i> Kontra Akun for Kode Akun : "+ id);
			$('.modal-body').css({'height':250})
			$('#id_kontra_akun').val('');
			$('#id_akun').val(id);
			$('#myModal')
				.css({'top':'20%'})
				.modal('show');
		break;
		case "Delete":
			jConfirm("Yakin data ini akan dihapus?","Confirm",function(r){
				if(r)
				{
					$.post('delakunkontra',{'id':id},function(result){ _show_data('y');})
				}
			})
		break;
	}
}

function _cari(){_show_data('1',$('#cari').val());}
function _aksi(id){_show_data(id);}
function _simpan_data()
{
	$.post('setkontraakun',$('#frm1').serialize(),function(result)
		{
			$('#result').html(result).show().fadeOut(5000)
			var c=$('#cari').val();
			_show_data('y',c);
		})
}
</script>